#include "libmsffmpeg/msffmpeg.h"

char control_cbfunc(void *pcontrol_cbfunc_arg)
{
	return 1;
}
char bitrate_cbfunc(void *bitrate_cbfunc_arg,int size,char flag_recv)
{
	return 0;
}
int detect_cbfunc(void * detect_cbfunc_arg,AVFrame *filt_frame,AVFrame *frame_dec,STREAMCODECContext *pscodec_ctt)
{
	return 0;
}
int main(int argc, char **argv)
{
	msffmepg_api_envinit();

	char control_cbfunc_arg;
	char bitrate_cbfunc_arg;
	char detect_cbfunc_arg;
	FFMPEGCONText *pffmpeg_ctt=msffmepg_api_init(control_cbfunc,&control_cbfunc_arg,bitrate_cbfunc,&bitrate_cbfunc_arg,detect_cbfunc,&detect_cbfunc_arg);
#if 1	
	char  cmdline[5120]={0};
	strcpy(cmdline, "ffmpeg  -stream_loop  -1 -i  \"udp://127.0.0.1:12036?timeout=2000&overrun_nonfatal=1&default_bufsize=1&block_sockcet=1\" -c:a mp3  -b:a 64000 -c:v copy   -metadata service_name=MSCORE(MultiCoreServer)   -metadata service_provider=MSAVSKIT(Email:msavskit@163.com)   -mpegts_service_id 65281   -mpegts_transport_stream_id 1   -mpegts_original_network_id 1   -mpegts_pmt_start_pid 4096   -mpegts_start_pid 20   -metadata encoder=mscore_encoder   -f mpegts udp://127.0.0.1:6000?timeout=2000&overrun_nonfatal=1&pkt_size=1316?pkt_size=1316  -loglevel 48");
	int ret=msffmepg_api_run( cmdline,   pffmpeg_ctt);
#else
	int ret=msffmepg_api_runcmd( argc,   argv,  pffmpeg_ctt);
#endif
	printf( "msffmepg_api_runcmd,ret=%d\n", ret);
	msffmepg_api_deinit(&pffmpeg_ctt);

	msffmepg_api_envdeinit();
}